package br.unicamp.mc715.transport;

import java.io.Serializable;

/**
 * This class implements a UDP message. <p>
 */
public class UDPMessage implements Message {
	UDPTransportId sender, receiver;
	Serializable payload;
	
    /**
     * Creates a new UDP message. <p>
     * 
     * @param payload the payload of this message.
     * @param sender the id of the socket sending this message.
     * @param receiver the id of the socket receiving this message. 
     */
    public UDPMessage(Serializable payload, UDPTransportId sender, UDPTransportId receiver) {
    	this.sender = sender;
    	this.receiver = receiver;
    	this.payload = payload;
    }
    
    /* (non-Javadoc)
     * @see Message#getPayload()
     */
    public Serializable getPayload() {
    	return payload;
    }
    
    /* (non-Javadoc)
     * @see Message#getSender()
     */
    public TransportId getSender() {
    	return sender;
    }

    /* (non-Javadoc)
     * @see Message#getReceiver()
     */
    public TransportId getReceiver() {
    	return receiver;
    }
}
